import { defineStore } from 'pinia'
let menu = localStorage.getItem('menu')
let menus:any = null
if (menu) {
    menus = JSON.parse(menu);
}
export const menuStore = defineStore({
  id: 'menu',
  state: () => {
    return {
        menu: menus?.menu||false,
    }
  },
  getters:{
      menushow() {
        this.menu = !this.menu
      },
  },
  actions: {
  },
   // 开启数据缓存
  persist: { //数据默认存在 sessionStorage 里，并且会以 store 的 id 作为 key
    enabled: true,
    strategies: [
      {
        key: 'menu',
        storage: localStorage,
      }
    ]
  }
})
